🔑 Key Idea of PCIe Flow Control
In PCIe, a transmitter cannot just blast packets endlessly toward its receiver.
Instead, it must track how much buffer space the receiver currently has available and only send as many TLPs (Transaction Layer Packets) as the receiver can accept.
This prevents:
- Buffer overflows (no lost packets)
- Disconnects/retries (unlike legacy PCI)
- Deadlocks (because control messages can always get through)
🧠 How It Works
-
Receiver Advertises Buffer Space
- Each PCIe receiver has VC Buffers (Virtual Channel Buffers) for each VC.
- It periodically sends Flow Control DLLPs (Data Link Layer Packets) to its link partner.
- These DLLPs report how many credits (slots) are available in the buffer for:
- Posted requests (memory writes)
- Non-posted requests (reads, IO writes)
- Completions (read responses)
-
Transmitter Tracks Credits
- The transmitter keeps a local count of the receiver’s available buffer credits.
- Each time it sends a TLP, it subtracts the appropriate credit.
- It stops transmitting once it runs out of credits for that VC.
-
Receiver Sends Updates
- As it processes and removes packets from its VC buffers, it frees space.
- It sends Flow Control Update DLLPs to tell the transmitter how many credits are now free again.
- The transmitter adds those credits back and can resume sending.
🛡 Why Use DLLPs Instead of TLPs?
- DLLPs are always allowed through, regardless of buffer space.
- If TLPs were used for credit updates, you could deadlock:
- The receiver's buffers might be full, preventing the credit update TLP from arriving.
- The transmitter would then never learn that space has been freed — and everything stalls.
- DLLPs are tiny control packets that bypass the TLP buffering mechanism — so credit updates are guaranteed to get through.
🎯 Key Takeaways
- Flow Control is fully handled in hardware, invisible to software.
- Credit-based scheme: transmitter must have credits to send.
- Prevents deadlock, overflow, retries, and wasted bandwidth.
- Three credit types: Posted, Non-Posted, Completion.